import React, { PureComponent } from 'react';
import { Button } from 'antd';

import './region.less';

class Region extends PureComponent {
  handleGoToCartification = countryCode => {
    this.props.history.push(`/user/certification/steps?countryCode=${countryCode}`);
  };

  render() {
    const account = sessionStorage.getItem('account')
      ? JSON.parse(sessionStorage.getItem('account'))
      : {};
    return (
      <div className="region">
        <h2>身份认证</h2>
        <i className="iconfont icon-cartification" />
        <Button type="primary" onClick={this.handleGoToCartification.bind(this, '00')}>
          大陆境内
        </Button>
        {account.cardLevel !== 1 && (
          <Button type="primary" onClick={this.handleGoToCartification.bind(this, '01')}>
            其他国家或地区
          </Button>
        )}
      </div>
    );
  }
}

export default Region;
